Repository navigation
fix(file-viewer): upgrade docx-preview to 0.4.1 to close w:sym innerHTML XSS - #9574
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
[Medium impact] The PR appears safe to merge; no blocking issue was found. SummaryUpgrades
Reviews (1) · Last reviewed commit: "fix(file-viewer): upgrade docx-preview t..." · Reviewed by Greptile |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docx-preview0.3.7 → 0.4.1 to close a stored XSS in the workspace DOCX previewrenderSymbolwrote the raww:sym/@w:charattribute intospan.innerHTML, so a crafted.docx(e.g.w:char="41;<img src=x onerror=…>") ran script on the app origin for any workspace member who previewed itwindow.document, so the injected<img>loads and firesonerrorbeforerenderAsyncresolvesw:charas hex (parseInt(…, 16)) and renders it as a text node;<style>elements are now built with text children instead ofinnerHTMLrenderAsyncsignature and options are unchanged; onlyrenderDocument(unused) changed. No new dependencies (still justjszip); lazy chunk grows ~0.5 KB gzippedsanitizeRenderedHyperlinks/stripEmbeddedFrames/renderAltChunks: falseguards stay as-is — 0.4.1 still copies relationship targets intohrefunchecked and still has the alt-chunksrcdocpathType of Change
Testing
.docxthroughrenderAsyncwith the component's exact options, against both UMD and the ESM entry Next bundles (import→dist/docx-preview.mjs), served over HTTP sosrc=x404s:<img>present,onerrorexecuted (red)<img>, no execution; legitimate WingdingsF04Asymbol renders the identical code point (green)w:pageBreakBefore(0.3.7 only honored it via styles) — page counts match the number of direct breaks exactly, matching Wordtsc --stricton the component'srenderAsynccall against the new typings (lib check on)bun install --frozen-lockfileaccepts the lockfile under the 7-dayminimumReleaseAgegate (0.4.1 published 2026-09-21); integrity matches the audited tarballChecklist
test-auditauthoring gate)